package doantotnghiep.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "TuHang")
public class Cabinet {
	
	private int id;
	private int status;	
	private String cabinetName;
	private int statusActivity;
	private int numberOfBatch;
	@Id
	@GeneratedValue
	@Column(name = "MaTu" )
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	@Column(name="TinhTrang")
	public int getStatus() {
		return status;
	}
	
	public void setStatus(int status) {
		this.status = status;
	}	
	
    private Set<MedicamentBatch> batchs = new HashSet<MedicamentBatch>();
    @OneToMany(mappedBy = "cabinet", fetch = FetchType.LAZY) 
	@Fetch(FetchMode.JOIN)
    public Set<MedicamentBatch> getBatchs() {
		return batchs;
	}

	public void setBatchs(Set<MedicamentBatch> batchs) {
		this.batchs = batchs;
	}

	@Column(name = "TenTu")
	public String getCabinetName() {
		return cabinetName;
	}

	public void setCabinetName(String cabinetName) {
		this.cabinetName = cabinetName;
	}

	@Column(name="TrangThai")
	public int getStatusActivity() {
		return statusActivity;
	}

	public void setStatusActivity(int statusActivity) {
		this.statusActivity = statusActivity;
	}
	@Column(name = "TongSoLo")
	public int getNumberOfBatch() {
		return numberOfBatch;
	}

	public void setNumberOfBatch(int numberOfBatch) {
		this.numberOfBatch = numberOfBatch;
	} 
}
